#include "stdafx.h"
#include "./playermsg.h"

PlayerMsg::PlayerMsg(int id,
					 string strName, 
					 Point startPos, 
					 float startAngle, 
					 Point hpPos,
					 float z,
					 Color color)
: Player(id, strName, startPos, startAngle, hpPos, z, color)
, m_pMsg(NULL)
, m_bHheading(true)
, m_bGo(false)
{
}

PlayerMsg::~PlayerMsg()
{

}

void PlayerMsg::SetMsg(TankMsg* pMsg)
{
	m_pMsg = pMsg;
	pMsg->bHheading = m_bHheading;
	m_pMsg->bGo = m_bGo;
}

void PlayerMsg::ClearMsg()
{
	m_pMsg = NULL;
}

//operation
void PlayerMsg::SetGoHeading(bool bGoAhead)
{
	m_bHheading = bGoAhead;
}

void PlayerMsg::Go(bool bGo)
{
	m_bGo = bGo;
}

void PlayerMsg::TurnRollToAngle(float dstRollAngle)
{
	m_pMsg->bTurnRollToAngle = true;
	m_pMsg->dstRollRadian = MathUtils::AngleToRadian(dstRollAngle);
}

void PlayerMsg::TurnGunToAngle(float dstGunAngle)
{
	m_pMsg->bTurnGunToAngle = true;
	m_pMsg->dstGunRadian = MathUtils::AngleToRadian(dstGunAngle);
}

void PlayerMsg::ReverseRollAngle(bool bPositive)
{
	m_pMsg->bReverseRollAngle = true;
	m_pMsg->bRollPositive = bPositive;
}

void PlayerMsg::ReverseGunAngle(bool bPositive)
{
	m_pMsg->bReverseGunAngle = true;
	m_pMsg->bGunPositive = bPositive;
}

void PlayerMsg::Shoot()
{
	m_pMsg->bShoot = true;
}

void PlayerMsg::SetSpeed(float speed)
{
	m_pMsg->bSetSpeed = true;
	m_pMsg->speed = speed;
}

void PlayerMsg::SetRollSpeed(float rollspeed)
{
	m_pMsg->bSetRollSpeed = true;
	m_pMsg->rollspeed = rollspeed;
}

void PlayerMsg::SetGunSpeed(float gunspeed)
{
	m_pMsg->bSetGunSpeed = true;
	m_pMsg->gunspeed = gunspeed;
}

int PlayerMsg::GetID()
{
	return Player::GetID();
}

Point PlayerMsg::GetPos()
{
	return Player::GetPos();
}

bool PlayerMsg::GetGo()
{
	return Player::GetGo();
}

float PlayerMsg::GetRollAngle()
{
	return Player::GetRollAngle();
}

float PlayerMsg::GetGunAngle()
{
	return Player::GetGunAngle();
}

float PlayerMsg::GetSpeed()
{
	return Player::GetSpeed();
}

float PlayerMsg::GetRollSpeed()
{
	return Player::GetRollSpeed();
}

float PlayerMsg::GetGunSpeed()
{
	return Player::GetGunSpeed();
}